from fastapi import APIRouter

from app.schemas.auth import AuthLoginSchema, AuthRegisterSchema
from app.services.user import user_service
from app.common.response.response_schema import response_base

router = APIRouter(tags=["auth"])


@router.post("/register")
async def register(obj: AuthRegisterSchema):
    await user_service.register(obj=obj)
    return await response_base.success()


@router.post("/login")
async def login(obj: AuthLoginSchema):
    data = await user_service.login(obj=obj)
    return await response_base.success(data=data)
